﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ATM
{
    public class TransferAccountsState3 : ATMState
    {
        public ATM atm;

        public TransferAccountsState3(ATM atm)
        {
            this.atm = atm;
        }

        public void pressPowerButton()
        {
            return;
        }

        public void pressTakeCashButton()
        {
            return;
        }

        public void pressInsertEnvelopButton()
        {
            return;
        }

        public void pressEnterButton()
        {
            if (this.atm.keypadScreen.Text == "")
            {
                System.Windows.Forms.MessageBox.Show("请输入数字后按Enter键确认!");
                return;
            }

            this.atm.commandString = this.atm.keypadScreen.Text;
            this.atm.commandNumber = Convert.ToInt32(this.atm.commandString);
            this.atm.keypadScreen.Text = "";

            switch (this.atm.commandNumber)
            {
                case 1:
                    this.atm.setState(this.atm.chooseTransactionState);
                    this.atm.screen.Text = "请选择交易类型\r\n";
                    this.atm.screen.Text += "1、取款\r\n";
                    this.atm.screen.Text += "2、查询余额\r\n";
                    this.atm.screen.Text += "3、转账\r\n";
                    this.atm.screen.Text += "4、存款\r\n";
                    this.atm.screen.Text += "5、退出\r\n";
                    break;

                case 2:
                    this.atm.setState(this.atm.printReceiptState);
                    this.atm.screen.Text = this.atm.receipt.getReceipitDetails();
                    this.atm.screen.Text += "\r\n\r\n";
                    this.atm.screen.Text += "请选择下一步操作:\r\n";
                    this.atm.screen.Text += "1、继续业务\r\n";
                    this.atm.screen.Text += "2、退出系统";
                    break;

                default:
                    System.Windows.Forms.MessageBox.Show("错误的选项!请重新选择");
                    break;
            }

            return;
        }
    }
}
